<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateOrderInfosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('order_goods', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('goods_id');
            $table->string('goods_name')->comment('冗余的商品名称，防止商品下架或删除后造成数据不一致');
            $table->decimal('goods_price')->comment('冗余的商品价格');
            $table->integer('goods_quantity')->comment('商品购买数量');
            $table->integer('goods_type')->nullable()->comment('商品规格');
            $table->string('goods_img')->nullable()->comment('冗余的商品图');

            $table->integer('order_id')->comment('订单id');
            $table->string('order_number')->nullable()->comment('订单号');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('order_infos');
    }
}
